package com.hee.erp.common;

import com.hee.erp.constant.ReturnCode;
import lombok.Data;

@Data
public class R<T> {
//    private Boolean success;
    private int code;
    private String message;
    private T result;

    public R(){

    }

    public static <T> R<T> success(T data){
        R<T> r = new R<>();
        r.setCode(ReturnCode.RC200.getCode());
        //r.setSuccess(true);
        r.setMessage(ReturnCode.RC200.getMsg());
        r.setResult(data);
        return r;
    }

    public static <T> R<T> fail(int code, String msg){
        R<T> r = new R<>();
        r.setCode(code);
        //r.setSuccess(false);
        r.setMessage(msg);
        return r;

    }
}